package com.example.iot.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.os.Looper;
import android.view.View;

import com.example.iot.R;
import com.example.iot.utils.DialogUtils;
import com.example.iot.utils.ToastUtils;

import java.util.Timer;
import java.util.TimerTask;

import butterknife.ButterKnife;
import butterknife.OnClick;

public class otherActivity extends AppCompatActivity {
    ToastUtils toastUtils=new ToastUtils(this);
    DialogUtils dialogUtils=new DialogUtils(this);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_other);
        ButterKnife.bind(this);

    }
    @OnClick(R.id.bt_other_sms)
    public void sms(){

    }
    @OnClick(R.id.bt_other_top)
    public void top(){
        toastUtils.showToastTopLong("顶部toast");
    }
    @OnClick(R.id.bt_other_center)
    public void center(){
        toastUtils.showToastCenterLong("中间toast");
    }
    @OnClick(R.id.bt_other_bottom)
    public void bottom(){
        toastUtils.showToastBottomLong("底部toast");
    }
    @OnClick(R.id.bt_other_loading)
    public void lo(){
        dialogUtils.initLoadingDialog("加载中");
        dialogUtils.showLoadingDialog();
        Timer timer=new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        dialogUtils.cancelLoadingDialog();
                    }
                });

            }
        },2000);
    }
    @OnClick(R.id.bt_other_dialog_main)
    public void main(){
        dialogUtils.showDailog("1111111111");
        dialogUtils.setBt2ClickListener(new DialogUtils.bt2ClickListener() {
            @Override
            public void onbt2Click(View view) {
                toastUtils.showToastBottomLong("toast提示");
            }
        });
    }
}